/**
 * Created by CodeTlan.
 * User: Ing. Miguel Salas
 * Date: 3/10/12
 * Time: 11:13 PM
 */
/**
 * Created by CodeTlan.
 * User: Ing. Miguel Salas
 * Date: 3/10/12
 * Time: 3:32 PM
 */
Ext.define('Ctc.store.Stores', {
    extend: 'Ext.data.Store',
    autoLoad: true,
    constructor:function(){
        this.proxy=this.buildProxy();
        this.callParent(arguments);
    },
    buildProxy:function(){
        return {
            type: 'ajax',
            url : this.urlRead,
            noCache: false,
            actionMethods: {
                read: 'POST'
            },
            reader: {
                type: 'json',
                root: 'data',
                totalProperty: 'total',
                successProperty: 'success'
            }
        };
    },
    setParams:function(params,load){
        this.on('beforeload',function(){
            this.proxy.extraParams=params;
        },this);
        if(load){
            this.load();
        }
    }
});